import request from '@/utils/request'

// 查询客户定时任务调度列表
export function listCustomerJob(query) {
  return request({
    url: '/customer/job/list',
    method: 'get',
    params: query
  })
}

// 查询客户定时任务调度详细
export function getCustomerJob(jobId) {
  return request({
    url: '/customer/job/' + jobId,
    method: 'get'
  })
}

// 创建HTTP任务
export function createHttpTask(data) {
  return request({
    url: '/customer/job/createHttpTask',
    method: 'post',
    data: data
  })
}

// 修改客户定时任务调度
export function updateCustomerJob(data) {
  return request({
    url: '/customer/job',
    method: 'put',
    data: data
  })
}

// 删除客户定时任务调度
export function delCustomerJob(jobId) {
  return request({
    url: '/customer/job/' + jobId,
    method: 'delete'
  })
}

// 客户任务状态修改
export function changeCustomerJobStatus(jobId, status) {
  const data = {
    jobId,
    status
  }
  return request({
    url: '/customer/job/changeStatus',
    method: 'put',
    data: data
  })
}

// 客户定时任务立即执行一次
export function runCustomerJob(jobId, jobGroup) {
  const data = {
    jobId,
    jobGroup
  }
  return request({
    url: '/customer/job/run',
    method: 'put',
    data: data
  })
}

// 新增客户定时任务调度
export function addCustomerJob(data) {
  return request({
    url: '/customer/job',
    method: 'post',
    data: data
  })
}

// 批量删除客户定时任务
export function delCustomerJobs(jobIds) {
  return request({
    url: '/customer/job/' + jobIds,
    method: 'delete'
  })
}